% This file generates Figure 8 in the paper. It plots the results obtained
% from running 'FIGs_5_6_Table_4_Baseline_Inflation.m' for all the
% alternative measures of inflation considered in the paper. In order to
% create the figure that file needs to be run for all the different
% inflation measures. This  file automatically imports information saved in
% the .xlsx file and creates the figure. 

clear; close all; clc;
                    
%% Importing the proper data. 

PI_IRF_OUT_ZLB_LP_UM_MEAN               = (xlsread('Inflation.xlsx','UM MEAN','B2:B14'));
PI_IRF_OUT_ZLB_LP_LB_UM_MEAN            = (xlsread('Inflation.xlsx','UM MEAN','C2:C14'));
PI_IRF_OUT_ZLB_LP_UB_UM_MEAN            = (xlsread('Inflation.xlsx','UM MEAN','D2:D14'));
PI_IRF_IN_ZLB_LP_UM_MEAN                = (xlsread('Inflation.xlsx','UM MEAN ZLB','B2:B14'));
PI_IRF_IN_ZLB_LP_LB_UM_MEAN             = (xlsread('Inflation.xlsx','UM MEAN ZLB','C2:C14'));
PI_IRF_IN_ZLB_LP_UB_UM_MEAN             = (xlsread('Inflation.xlsx','UM MEAN ZLB','D2:D14'));
PI_IRF_OUT_ZLB_SLP_UM_MEAN              = (xlsread('Inflation.xlsx','UM MEAN','E2:E14'));
PI_IRF_OUT_ZLB_SLP_LB_UM_MEAN           = (xlsread('Inflation.xlsx','UM MEAN','F2:F14'));
PI_IRF_OUT_ZLB_SLP_UB_UM_MEAN           = (xlsread('Inflation.xlsx','UM MEAN','G2:G14'));
PI_IRF_IN_ZLB_SLP_UM_MEAN               = (xlsread('Inflation.xlsx','UM MEAN ZLB','E2:E14'));
PI_IRF_IN_ZLB_SLP_LB_UM_MEAN            = (xlsread('Inflation.xlsx','UM MEAN ZLB','F2:F14'));
PI_IRF_IN_ZLB_SLP_UB_UM_MEAN            = (xlsread('Inflation.xlsx','UM MEAN ZLB','G2:G14'));  
       
PI_IRF_OUT_ZLB_LP_SPF_MEDIAN            = (xlsread('Inflation.xlsx','SPF CPI MEDIAN','B2:B14'));
PI_IRF_OUT_ZLB_LP_LB_SPF_MEDIAN         = (xlsread('Inflation.xlsx','SPF CPI MEDIAN','C2:C14'));
PI_IRF_OUT_ZLB_LP_UB_SPF_MEDIAN         = (xlsread('Inflation.xlsx','SPF CPI MEDIAN','D2:D14'));
PI_IRF_IN_ZLB_LP_SPF_MEDIAN             = (xlsread('Inflation.xlsx','SPF CPI MEDIAN ZLB','B2:B14'));
PI_IRF_IN_ZLB_LP_LB_SPF_MEDIAN          = (xlsread('Inflation.xlsx','SPF CPI MEDIAN ZLB','C2:C14'));
PI_IRF_IN_ZLB_LP_UB_SPF_MEDIAN          = (xlsread('Inflation.xlsx','SPF CPI MEDIAN ZLB','D2:D14'));
PI_IRF_OUT_ZLB_SLP_SPF_MEDIAN           = (xlsread('Inflation.xlsx','SPF CPI MEDIAN','E2:E14'));
PI_IRF_OUT_ZLB_SLP_LB_SPF_MEDIAN        = (xlsread('Inflation.xlsx','SPF CPI MEDIAN','F2:F14'));
PI_IRF_OUT_ZLB_SLP_UB_SPF_MEDIAN        = (xlsread('Inflation.xlsx','SPF CPI MEDIAN','G2:G14'));
PI_IRF_IN_ZLB_SLP_SPF_MEDIAN            = (xlsread('Inflation.xlsx','SPF CPI MEDIAN ZLB','E2:E14'));
PI_IRF_IN_ZLB_SLP_LB_SPF_MEDIAN         = (xlsread('Inflation.xlsx','SPF CPI MEDIAN ZLB','F2:F14'));
PI_IRF_IN_ZLB_SLP_UB_SPF_MEDIAN         = (xlsread('Inflation.xlsx','SPF CPI MEDIAN ZLB','G2:G14'));  

PI_IRF_OUT_ZLB_LP_SPF_DEF_MEDIAN        = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN','B2:B14'));
PI_IRF_OUT_ZLB_LP_LB_SPF_DEF_MEDIAN     = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN','C2:C14'));
PI_IRF_OUT_ZLB_LP_UB_SPF_DEF_MEDIAN     = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN','D2:D14'));
PI_IRF_IN_ZLB_LP_SPF_DEF_MEDIAN         = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN ZLB','B2:B14'));
PI_IRF_IN_ZLB_LP_LB_SPF_DEF_MEDIAN      = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN ZLB','C2:C14'));
PI_IRF_IN_ZLB_LP_UB_SPF_DEF_MEDIAN      = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN ZLB','D2:D14'));
PI_IRF_OUT_ZLB_SLP_SPF_DEF_MEDIAN       = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN','E2:E14'));
PI_IRF_OUT_ZLB_SLP_LB_SPF_DEF_MEDIAN    = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN','F2:F14'));
PI_IRF_OUT_ZLB_SLP_UB_SPF_DEF_MEDIAN    = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN','G2:G14'));
PI_IRF_IN_ZLB_SLP_SPF_DEF_MEDIAN        = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN ZLB','E2:E14'));
PI_IRF_IN_ZLB_SLP_LB_SPF_DEF_MEDIAN     = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN ZLB','F2:F14'));
PI_IRF_IN_ZLB_SLP_UB_SPF_DEF_MEDIAN     = (xlsread('Inflation.xlsx','SPF DEFLATOR MEDIAN ZLB','G2:G14'));  
    
PI_IRF_OUT_ZLB_LP_CLEVELAND            = (xlsread('Inflation.xlsx','CLEVELAND','B2:B14'));
PI_IRF_OUT_ZLB_LP_LB_CLEVELAND         = (xlsread('Inflation.xlsx','CLEVELAND','C2:C14'));
PI_IRF_OUT_ZLB_LP_UB_CLEVELAND         = (xlsread('Inflation.xlsx','CLEVELAND','D2:D14'));
PI_IRF_IN_ZLB_LP_CLEVELAND             = (xlsread('Inflation.xlsx','CLEVELAND ZLB','B2:B14'));
PI_IRF_IN_ZLB_LP_LB_CLEVELAND          = (xlsread('Inflation.xlsx','CLEVELAND ZLB','C2:C14'));
PI_IRF_IN_ZLB_LP_UB_CLEVELAND          = (xlsread('Inflation.xlsx','CLEVELAND ZLB','D2:D14'));
PI_IRF_OUT_ZLB_SLP_CLEVELAND           = (xlsread('Inflation.xlsx','CLEVELAND','E2:E14'));
PI_IRF_OUT_ZLB_SLP_LB_CLEVELAND        = (xlsread('Inflation.xlsx','CLEVELAND','F2:F14'));
PI_IRF_OUT_ZLB_SLP_UB_CLEVELAND        = (xlsread('Inflation.xlsx','CLEVELAND','G2:G14'));
PI_IRF_IN_ZLB_SLP_CLEVELAND            = (xlsread('Inflation.xlsx','CLEVELAND ZLB','E2:E14'));
PI_IRF_IN_ZLB_SLP_LB_CLEVELAND         = (xlsread('Inflation.xlsx','CLEVELAND ZLB','F2:F14'));
PI_IRF_IN_ZLB_SLP_UB_CLEVELAND         = (xlsread('Inflation.xlsx','CLEVELAND ZLB','G2:G14'));   
    
%% Creating the Figure (this file generates both the SLP and the LP IRFs.)

t       =   0:8;  

figure;
subplot(2,2,1)
shadedplot(t,PI_IRF_OUT_ZLB_LP_LB_UM_MEAN',PI_IRF_OUT_ZLB_LP_UB_UM_MEAN',[0.75,0.75,0.75],'w');
hold on
U       =   plot(t,PI_IRF_OUT_ZLB_LP_UM_MEAN,'x-b',t,PI_IRF_IN_ZLB_LP_UM_MEAN,'-r',...
            t,PI_IRF_IN_ZLB_LP_LB_UM_MEAN,'*--r',t,PI_IRF_IN_ZLB_LP_UB_UM_MEAN,'*--r','Linewidth',1.5);
hold on 
grid on
title('MIE Mean','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(2,2,2)
shadedplot(t,PI_IRF_OUT_ZLB_LP_LB_CLEVELAND',PI_IRF_OUT_ZLB_LP_UB_CLEVELAND',[0.75,0.75,0.75],'w');
hold on
U       = plot(t,PI_IRF_OUT_ZLB_LP_CLEVELAND,'x-b',t,PI_IRF_IN_ZLB_LP_CLEVELAND,'-r',...
               t,PI_IRF_IN_ZLB_LP_LB_CLEVELAND,'*--r',t,PI_IRF_IN_ZLB_LP_UB_CLEVELAND,'*--r','Linewidth',1.5);
hold on
h       =   legend(U, 'No ZLB','ZLB','Location','NorthWest');
set(h,'Interpreter','latex');
grid on
title('Cleveland Fed Survey','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(2,2,3)
shadedplot(t,PI_IRF_OUT_ZLB_LP_LB_SPF_MEDIAN',PI_IRF_OUT_ZLB_LP_UB_SPF_MEDIAN',[0.75,0.75,0.75],'w');
hold on
U       = plot(t,PI_IRF_OUT_ZLB_LP_SPF_MEDIAN,'x-b',t,PI_IRF_IN_ZLB_LP_SPF_MEDIAN,'-r',...
        t,PI_IRF_IN_ZLB_LP_LB_SPF_MEDIAN,'*--r',t,PI_IRF_IN_ZLB_LP_UB_SPF_MEDIAN,'*--r','Linewidth',1.5);
hold on
title('SPF Median','Interpreter','latex','fontSize',14);
grid on
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(2,2,4)
shadedplot(t,PI_IRF_OUT_ZLB_LP_LB_SPF_DEF_MEDIAN',PI_IRF_OUT_ZLB_LP_UB_SPF_DEF_MEDIAN',[0.75,0.75,0.75],'w');
hold on
U       = plot(t,PI_IRF_OUT_ZLB_LP_SPF_DEF_MEDIAN,'x-b',t,PI_IRF_IN_ZLB_LP_SPF_DEF_MEDIAN,'-r',...
               t,PI_IRF_IN_ZLB_LP_LB_SPF_DEF_MEDIAN,'*--r',t,PI_IRF_IN_ZLB_LP_UB_SPF_DEF_MEDIAN,'*--r','Linewidth',1.5);
grid on
title('SPF Deflator Median','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);

A       =   suptitle('Expected Inflation to Productivity LP');
set(A,'Interpreter','latex','fontSize',18);

figure;
subplot(2,2,1)
shadedplot(t,PI_IRF_OUT_ZLB_SLP_LB_UM_MEAN',PI_IRF_OUT_ZLB_SLP_UB_UM_MEAN',[0.75,0.75,0.75],'w');
hold on
plot(t,PI_IRF_OUT_ZLB_SLP_UM_MEAN,'x-b',t,PI_IRF_IN_ZLB_SLP_UM_MEAN,'-r',...
     t,PI_IRF_IN_ZLB_SLP_LB_UM_MEAN,'*--r',t,PI_IRF_IN_ZLB_SLP_UB_UM_MEAN,'*--r','Linewidth',1.5);
grid on
title('MIE Mean','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(2,2,2)
shadedplot(t,PI_IRF_OUT_ZLB_SLP_LB_CLEVELAND',PI_IRF_OUT_ZLB_SLP_UB_CLEVELAND',[0.75,0.75,0.75],'w');
hold on
U       =   plot(t,PI_IRF_OUT_ZLB_SLP_CLEVELAND,'x-b',t,PI_IRF_IN_ZLB_SLP_CLEVELAND,'-r',...
            t,PI_IRF_IN_ZLB_SLP_LB_CLEVELAND,'*--r',t,PI_IRF_IN_ZLB_SLP_UB_CLEVELAND,'*--r','Linewidth',1.5);
hold on
h       =   legend(U, 'No ZLB','ZLB','Location','NorthWest');
set(h,'Interpreter','latex');
grid on
title('Cleveland Fed Survey','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(2,2,3)
shadedplot(t,PI_IRF_OUT_ZLB_SLP_LB_SPF_MEDIAN',PI_IRF_OUT_ZLB_SLP_UB_SPF_MEDIAN',[0.75,0.75,0.75],'w');
hold on
plot(t,PI_IRF_OUT_ZLB_SLP_SPF_MEDIAN,'x-b',t,PI_IRF_IN_ZLB_SLP_SPF_MEDIAN,'-r',...
     t,PI_IRF_IN_ZLB_SLP_LB_SPF_MEDIAN,'*--r',t,PI_IRF_IN_ZLB_SLP_UB_SPF_MEDIAN,'*--r','Linewidth',1.5);
grid on
title('SPF Median','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
subplot(2,2,4)
shadedplot(t,PI_IRF_OUT_ZLB_SLP_LB_SPF_DEF_MEDIAN',PI_IRF_OUT_ZLB_SLP_UB_SPF_DEF_MEDIAN',[0.75,0.75,0.75],'w');
hold on
plot(t,PI_IRF_OUT_ZLB_SLP_SPF_DEF_MEDIAN,'x-b',t,PI_IRF_IN_ZLB_SLP_SPF_DEF_MEDIAN,'-r',...
     t,PI_IRF_IN_ZLB_SLP_LB_SPF_DEF_MEDIAN,'*--r',t,PI_IRF_IN_ZLB_SLP_UB_SPF_DEF_MEDIAN,'*--r','Linewidth',1.5);
grid on
title('SPF Deflator Median','Interpreter','latex','fontSize',14);
xlabel('Horizon','Interpreter','latex','fontSize',12);
ylabel('Percent','Interpreter','latex','fontSize',12);
A       =   suptitle('Expected Inflation to Productivity SLP');
set(A,'Interpreter','latex','fontSize',18);

